using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace SpaceInvaders
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Projectile : Sprite, Boundable
    {
        public int direction = 1;

        public Projectile(Game game, int width, int height, String location)
            : base(game, width, height, location)
        {
            color = Color.Green;
            velocity = new Vector2(0, 5);
        }

        public void Move()
        {
            position -= velocity * direction;
        }
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            base.Initialize();
        }

        

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            Move();
            base.Update(gameTime);
        }

        public bool OutOfBounds()
        {
            return (position.Y < 0 || position.Y + height > Game1.screenHeight);

        }
    }
}
